package com.example.demo1.service;
import com.example.demo1.dao.UserMapper;
import com.example.demo1.model.UserInfo;
import com.example.demo1.model.VO.UserInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 言初
 * Date: 2024-06-19
 * Time: 18:17
 */
@Service
public class UserService {
    // 先需要注入我们的mapper
    @Autowired
    private UserMapper userMapper;

    // 注册方法，把用户注册数据存储到数据库的用户表中
    public int reg(UserInfo userInfo){
        return userMapper.reg(userInfo);
    }

    // 登录方法，通过用户名查询对象
    public UserInfo getUserByName(String username){
        return userMapper.getUserByName(username);
    }


    // 根据用户ID来查询用户对象
    public UserInfoVO getUserById(int uid){
        return userMapper.getUserById(uid);
    }


}
